#include<bits/stdc++.h>
using namespace std;
const int N=1e6+5;
int n,f[N];
char s[N],t[N];
int main(){
	freopen("hard.in","r",stdin);
freopen("hard.out","w",stdout);
	scanf("%d %s %s",&n,s+1,t+1);
	int p0=1,p1=1,l=1,f0=1,f1=1;
	for(int i=1;i<=n;++i){ 
		if(s[i]==t[i]){
			l=i+1;
		//	f[i]=1e9;
			f[i]=f[i-1];
		}else f[i]=f[l-1]+1;
	//	f[i]=1e9;
		if(t[i]=='1'){
			p0=i+1;
			f[i]=min(f[i],f[p1-1]+1);
		}else{
			p1=i+1;
			f[i]=min(f[i],f[p0-1]+1);
		}
		if(t[i]=='0'&&t[i-1]!='0') ++f0;
		if(t[i]=='1'&&t[i-1]!='1') ++f1;	
		f[i]=min(f[i],min(f0,f1));
		f0=min(f0,f[i]+1);
		f1=min(f1,f[i]+1);
	
	}
//	for(int i=n-100;i<=n;++i) cerr<<s[i];cerr<<'\n';
//	for(int i=n-100;i<=n;++i) cerr<<t[i];cerr<<'\n';
	printf("%d\n",f[n]);
	return 0;
}

